<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddIndexExpiresInTokenRefreshTokenTable extends AbstractMigration
{
    public function up()
    {
        $this->table('oauth_token')->addIndex(['expires'], ['name' => 'idx_expires'])->save();
        $this->table('oauth_refresh_token')->addIndex(['expires'], ['name' => 'idx_expires'])->save();
    }

    public function down()
    {
        $this->table('oauth_token')->removeIndexByName('idx_expires')->save();
        $this->table('oauth_refresh_token')->removeIndexByName('idx_expires')->save();
    }
}
